package pulpfizz.pulp.ui;

import pulpcore.Input;
import pulpcore.animation.Easing;
import pulpcore.image.CoreGraphics;
import pulpcore.sprite.Sprite;

/**
 * A SmoothMouse polls the input adapter for the mouse position and causes
 * this sprite's position to move with a defined amount of lag.
 * 
 * @author Greg
 *
 */
public class SmoothMouse extends Sprite
{
	/**
	 * The amount of lag, in milliseconds, that the SmoothMouse's position will follow
	 * behind the true mouse position.
	 */
	int followLag = 5;
	Easing EASE = Easing.NONE;

    public SmoothMouse()
	{
    	super(0,0,0,0);
    }
	
	void moveTo(double x, double y)
	{
		this.x.animateTo(x, followLag);
		this.y.animateTo(y,followLag);
	}
	
	public void update(int elapsedTime)
	{
		super.update(elapsedTime);
		moveTo(Input.getMouseX(),Input.getMouseY());
	}

	@Override
	protected void drawSprite(CoreGraphics arg0)
	{
	}

	public int getFollowLag()
	{
		return followLag;
	}

	public void setFollowLag(int followLag)
	{
		this.followLag = followLag;
	}
}
